package murcielago.util;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 *
 * @author gato
 */
public class ReadFile {
    
    public String readFile(String path){
        String str = null;
            try {
                InputStream is = getClass().getResourceAsStream(path);
                InputStreamReader r = new InputStreamReader(is);
                char[] buffer = new char[32];
                StringBuffer sb = new StringBuffer();
                int count;
                while ((count = r.read(buffer, 0, buffer.length)) > -1) {
                    sb.append(buffer, 0, count);
                }
                str = sb.toString();
            } catch (IOException ex) {
                str = "Failed to load text";
            }
        
        return str;
    }
    
}
